package com.example.xyblog.Service;

import com.example.xyblog.Model.Articleinfo;
import com.example.xyblog.mapper.ArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {
    @Autowired
    private ArticleMapper articleMapper;

    public List<Articleinfo> getMyList(Integer uid){
        return articleMapper.getMyList(uid);
    }

    public Articleinfo getBlog(Integer id){
        return articleMapper.getBlog(id);
    }

    public List<Articleinfo> geAll(){
        return articleMapper.getAll();
    }

    public Articleinfo getBlogById(Integer id){
        return articleMapper.getBlogById(id);
    }

    public int update(String title, String content, Integer aid,Integer states){
        return articleMapper.update(title,content,aid,states);
    }


   public int updateThumb(Integer num,Integer id){
        return articleMapper.updateThumb(num,id);
   }

   public int editArt(String title,String content,Integer uid,Integer state){
        return articleMapper.editArt(title,content,uid,state);
   }

   public List<Articleinfo> getCut(Integer psize,Integer pindex){
        Integer temp=(pindex-1)*psize;
        return articleMapper.getCut(psize,temp);
   }
}
